package com.haoshuang.zhouzhoubang.ui.vm

import com.haoshuang.zhouzhoubang.model.api.ApiRepo
import com.haoshuang.zhouzhoubang.model.bean.BalanceDetailGroupListBean
import com.mufeng.libs.base.BaseViewModel
import com.mufeng.libs.net.netRequest
import com.mufeng.libs.state.StateData
import com.mufeng.libs.state.StatefulMutableLiveData

class ViolationDeductMoneyOrderListViewModel : BaseViewModel() {
    /**
     * 获取余额明细分组列表
     */
    val masterBillGroupByDayListData = StatefulMutableLiveData<BalanceDetailGroupListBean>()
    fun masterBillGroupByDayList(id: String, page: Int) = netRequest {
        start { masterBillGroupByDayListData.value = StateData.Loading }
        request { ApiRepo.getViolationDeductMoneyOrderList(id, page) }
        success { masterBillGroupByDayListData.value = StateData.Success(it.data) }
        error { code, msg ->
            masterBillGroupByDayListData.value = StateData.Error(code, msg)
        }
    }

}